<?php
class PageController extends CommonController {
	public function index() {
		$info=M('Page')->where(array('key'=>$_GET['key']))->find();
		$this->assign('info',$info);
		$this->display ();
	}
	public function appointment(){
		if($this->isGet()){
			$hair_stylist_list=M('HairStylist')->order('sort asc')->select();
			$this->assign('hair_stylist_list',$hair_stylist_list);
			$project_list=M('Project')->order('sort asc')->select();
			$this->assign('project_list',$project_list);
			$this->dispaly();
		}else{
			$db=D('Appointment');
			if(!$db->create ()){
				$rs['status']=2;
				$rs['error']=$db->getError();
				exit(json_encode($rs));
			}else{
				$db->save($_POST);
				$rs['status']=1;
				echo json_encode($rs);
			}
		}
	}
}